package mvc;

import java.util.HashMap;
import java.util.Map;

import javax.security.auth.spi.LoginModule;

import mvc.form.LoginForm;
import mvc.form.RegisterForm;

public class ActionMapping {
	public ActionMapping(){
		
	}
	
	public static Map<String,String> getMap(){
		Map<String,String> map = new HashMap<String,String>();
//		map.put("mvc.form.LoginForm", "mvc.action.LoginAction");
//		map.put("mvc.form.RegisterForm","mvc.action.RegisterAction");
//		map.put("mvc.business.SomeForm","mvc.business.SomeAction");
		
		Class<LoginForm> loginModel = LoginForm.class;
		Class<RegisterForm> registerModel = RegisterForm.class;
		
		String loginVal = "";
		if(loginModel.isAnnotationPresent(ModelName.class)){
			loginVal = loginModel.getAnnotation(ModelName.class).value();
		}
		
		String registerVal = "";
		if(registerModel.isAnnotationPresent(ModelName.class)){
			registerVal = registerModel.getAnnotation(ModelName.class).value();
		}
		System.out.println("loginVal:"+loginVal);
		System.out.println("registerVal:"+registerVal);
		
		map.put("mvc.form."+loginVal, "mvc.action.LoginAction");
		map.put("mvc.form."+registerVal,"mvc.action.RegisterAction");
		return map;
	}

}
